package study.java.jdk.jdk8._1_stream.collectors.summary;

import lombok.extern.slf4j.Slf4j;
import org.junit.Test;

import java.util.Arrays;
import java.util.Comparator;
import java.util.List;
import java.util.Optional;
import java.util.stream.Collectors;

@Slf4j
public class maxBy_Test {

    List<Integer> src = Arrays.asList(1, 2, 3);

    @Test
    public void test() {
        Optional<Integer> max = src.stream()
                .collect(Collectors.maxBy(Comparator.naturalOrder()));
        log.info("max= {}", max.get());
    }
}
